import java.util.Scanner;

public class HJ67 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String numberString = scanner.nextLine();
        String[] numbersStr = numberString.split(" ");
        int[] numbers = new int[4];
        int[] visit = new int[4];
        boolean flag = false;
        for (int i = 0; i < 4; i++) {
            numbers[i] = Integer.valueOf(numbersStr[i]);
        }
        for (int i = 0; i < 4; i++) {
            visit[i] = 1;
            if (dfs(numbers,visit,numbers[i])){
                flag = true;
                break;
            }
        }
        System.out.println(flag);
    }

    private static boolean dfs(int[] nums,int[] visit,int temp){
        for (int i = 0; i < nums.length; i++) {
            if (visit[i] == 0){
                visit[i] = 1;
                if( dfs(nums,visit,temp + nums[i])||
                dfs(nums,visit,temp - nums[i]) ||
                dfs(nums,visit,temp*nums[i]) ||
                        (dfs(nums,visit,temp/nums[i]) && temp%nums[i] == 0)){
                    return true;
                }
                visit[i] = 0;
            }
        }
        if (temp == 24){
            return true;
        }else {
            return false;
        }
    }
}
